<div id="app">
  <p>{{name}} published {{count2}} books:</p>
  <button @click="add">Add book</button>
</div>
<script src="https://unpkg.com/vue@next"></script>
<script>
  const vm = Vue.createApp({
    data() {
      return {
        name: 'John Doe',
        books: ['book1']
      }
    },
    methods: {
      add() {
        this.books.push('book')
      },
      count() {
        console.log('hello')
        return this.books.length
      }
    },
    computed: {
      count2() {
        console.log('hello')
        return this.books.length
      }
    }
  }).mount('#app')
</script>